/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

/**
 *
 * @author wpc
 */
public class Event implements Comparable<Event>{

    private boolean arrival;
    private Packet packet;

    public Event(Packet packet) {
        this(true, packet);
    }

    public Event(boolean arrival, Packet packet) {
        this.arrival = arrival;
        this.packet = packet;
    }

    public boolean isArrival() {
        return arrival;
    }

    public Packet getPacket() {
        return packet;
    }

    public int compareTo(Event o) {
        double f = this.packet.getFinish();
        double fo = o.getPacket().getFinish();
        if(f<fo){
            return -1;
        }else if(f==fo){
            return 0;
        }else
            return 1;
    }

}
